<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入 vue.js 文件 -->
    <script src="../js/vue.js"></script>
    <style>
        .active {
            color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 错误的做法：这里不可以使用mustache -->
        <!-- <img src="{{imgUrl}}" alt=""> -->

        <!-- 正确的做法：使用 v-bind 指令 -->
        <!-- v-bind:class 可以写成 :class -->

        <!-- <h2 v-bind:class="{key1:value1,key2:value2}"></h2> -->
        <!-- <h2 v-bind:class="{类名1:true,类名2:true}"></h2> -->

        <h2 :class="{active:isActive,link:isLine}">{{message}}</h2>
        <button @click="btn">按钮</button>

    </div>
    <script>
        new Vue({
            el: "#app",
            data: {
                message: "Hello Vue",
                isActive: true,
                isLine: false
            },
            methods: {
                btn: function () {
                    this.isActive = !this.isActive;
                }
            }
        });
    </script>
</body>

</html>